﻿using System;
using System.Globalization;
using System.Windows.Data;

namespace Infrastructure.Converters;

public class SexConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        var isParse = int.TryParse(value.ToString(), out var result);
        if (isParse)
        {
            var sex = result == 1 ? "女" : "男";
            return sex;
        }
        return null;
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        return null;
    }
}
